package com.teamin.web.model;

import com.teamin.config.ErrorCode;
import org.springframework.http.HttpStatus;

/**
 * 错误信息
 * <p>
 * Created by bysocket on 13/03/2017.
 */

public class ErrorInfo {

    private int status;
    private int errorCode;
    private String message;

    /**
     * @param org.springframework.http.HttpStatus
     * @param errorCode                           错误代码
     * @param message                             信息
     */
    public ErrorInfo(HttpStatus httpStatus, int errorCode, String message) {
        this.status = httpStatus.value();
        this.errorCode = errorCode;
        this.message = message;
    }

    /**
     * @Author: yangrui
     * @Description:
     * @Date: 下午2:28 2017/11/21
     */
    public ErrorInfo(int status, String message) {
        this.status = status;
        this.message = message;
    }

    /**
     * @param httpStatus
     * @param errorConfig
     */
    public ErrorInfo(HttpStatus httpStatus, ErrorCode errorConfig) {
        this.status = httpStatus.value();
        this.errorCode = errorConfig.value();
        this.message = errorConfig.getMessage();
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

}
